/********************************
Creat Object: Function constructor
*/


function Person(name, yearOfBirth, job) {
    this.name = name;
    this.yearOfBirth = yearOfBirth;
    this.job = job;
    this.calculateAge = function() {
        console.log(2016 - this.yearOfBirth);
    }
}

var john = new Person('John', 1990, 'teacher');
john.calculateAge();

var jane = new Person('Jane', 1991, 'developer');
jane.calculateAge();

// 假设有10000个Person的对象，那么这些所有的对象的calculateAge()方法都相同，但是有10000分拷贝，浪费内存

console.log(john.calculateAge === jane.calculateAge);       //false